package com.coscon.test;

import java.awt.*;
import java.awt.event.InputEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Reboot_ShutdownExecShellTest1 {

    public static void pressKey(Robot robot,int[] keys,int delay){
        for(int i=0;i<keys.length;i++){
            robot.keyPress(keys[i]);
            robot.keyRelease(keys[i]);
            robot.delay(500);
        }
        //处理完需要延迟
        robot.delay(delay);
    }

    public static void clickMouse(Robot robot,int x,int y,int delay){
        robot.mouseMove(x, y);
        robot.delay(100);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        robot.delay(delay);
    }

    public static void main(String[] args) {
        try {
            Robot robot = new Robot();
            clickMouse(robot, 28, 15, 100);
//            clickMouse(robot, 28, 200, 100);//睡眠按钮
//            clickMouse(robot, 28, 220, 100);//重新启动按钮
            clickMouse(robot, 28, 240, 100);//关机按钮
        } catch (AWTException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
